package com.lyhui.nursinguser5010.service.impl;

import com.lyhui.nursinguser5010.dao.NursingPatientMapper;
import com.lyhui.nursinguser5010.pojo.NursingPatient;
import com.lyhui.nursinguser5010.service.NursingPatientService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * NursingPatient表的服务实现类
 *
 * @author lyhui
 * @create-time 2020-02-18 19:29:05
 */
@Service("nursingPatientService")
public class NursingPatientServiceImpl implements NursingPatientService {
    //private static final Logger logger = LoggerFactory.getLogger(NursingPatientServiceImpl.class);
    
    @Resource
    private NursingPatientMapper nursingPatientMapper;
    
    /**
     * 查询NursingPatient表的所有记录
     *
     * @return NursingPatient的实例对象集合List（封装了NursingPatient表的所有记录）
     */
    @Override
    public List<NursingPatient> queryAllNursingPatient() {
        return this.nursingPatientMapper.queryAllNursingPatient();
    }
    
    /**
     * 查询NursingPatient表中的一条记录
     *
     * @param  nursingPatient（封装了相关查询条件）
     * @return NursingPatient的实例对象（封装了NursingPatient表的一条记录）
     */
     @Override
    public NursingPatient queryNursingPatientByParam(NursingPatient nursingPatient){
        if(nursingPatient==null){
            return null;
        }
        return this.nursingPatientMapper.queryNursingPatientByParam(nursingPatient);
    }
    
    /**
     * 查询NursingPatient表中的多条记录
     *
     * @param  nursingPatient（封装了相关查询条件）
     * @return NursingPatient的实例对象集合List（封装了NursingPatient表的多条记录）
     */
    public List<NursingPatient> queryNursingPatientListByParam(NursingPatient nursingPatient){
        if(nursingPatient==null){
            return null;
        }
        return this.nursingPatientMapper.queryNursingPatientListByParam(nursingPatient);
    }
    
    /**
     * 在NursingPatient表中的添加一条记录
     *
     * @param  nursingPatient（封装了想要添加的记录信息）
     * @return 添加记录的反馈结果(1:添加记录成功；0：添加记录失败)
     */
    @Override
    public int insertNursingPatient(NursingPatient nursingPatient) {
        if(nursingPatient==null){
            return 0;
        }
        return this.nursingPatientMapper.insertNursingPatient(nursingPatient);
    }

    /**
     * 修改NursingPatient表中的一条记录
     *
     * @param  nursingPatient（封装了准备修改的记录信息）
     * @return 修改记录的反馈结果(1:修改记录成功；0：修改记录失败)
     */
    @Override
    public int updateNursingPatient(NursingPatient nursingPatient) {
        if(nursingPatient==null){
            return 0;
        }
        return this.nursingPatientMapper.updateNursingPatient(nursingPatient);
    }

    /**
     * 删除NursingPatient表中的一条记录
     *
     * @param  patientId ： NursingPatient表的主键
     * @return 删除记录反馈结果(1：删除记录成功|0：删除记录失败)
     */
    @Override
    public int deleteNursingPatientById(Integer patientId) {
        if(patientId==null){
            return 0;
        }
        return this.nursingPatientMapper.deleteNursingPatientById(patientId);
    }
}